import { defineStore } from "pinia";

let userStore = defineStore({
    id: "userStore",
    state:()=>{
        return {
            name:"佚名",
            age:18 //默认值
        }
    },
    getters:{
        getNameLength(){
            return this.name.length;
        },
        getChengnian(){
            return this.age >= 18;
        }
    },
    actions:{
       incrmentAge(){
         this.age++;
       }
    }

})

export default userStore;
